<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="common.jspf"%>
<!DOCTYPE HTML>
<html>
  <head>
      <style>
          body {
              padding-right: 0px !important;
          }
          *.modal-open {
              overflow-y: scroll;
              padding-right: 0 !important;
          }
      </style>
    <title>航空学院后台管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="" />

    <script type="application/x-javascript">
        addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); }
    </script>

    <!-- js-->
    <script src="${hkxyPath}/resources/js/modernizr.custom.js"></script>
    <!-- echarts.js-->
    <script src="${hkxyPath}/resources/js/echarts.min.js"></script>
    <!-- Metis Menu -->
    <script src="${hkxyPath}/resources/js/metisMenu.min.js"></script>
    <script src="${hkxyPath}/resources/js/custom.js"></script>
    <link href="${hkxyPath}/resources/css/custom.css" rel="stylesheet">
    <!--//Metis Menu -->

    <!-- Ajax载入页面 -->
    <script>
        $(function ($) {
            $("#adminManage").click(function () {
                $("#main").load("${hkxyPath}/user/admin-list", null, null);
                history.pushState(null, null, "${hkxyPath}/user/admin-list")
            });
            $("#ftpManage").click(function () {
                $("#main").load("${hkxyPath}/downloads/ftp-manage", null, null);
                history.pushState(null, null, "${hkxyPath}/downloads/ftp-manage")
            });

        });
        function onlyManage(name) {
            $("#main").load("${hkxyPath}/"+name+"/manage", null, null);
            history.pushState(null, null, "${hkxyPath}/"+name+"/manage")
        }
        function articlePublish(type){

            $("#main").load("${hkxyPath}/"+type+"/publish", null, null);
            history.pushState(null, null, "${hkxyPath}/"+type+"/publish")
        }
        function articleManage(type) {
            $("#main").load("${hkxyPath}/"+type+"/manage", null, null);
            history.pushState(null, null, "${hkxyPath}/"+type+"/manage")
        }
        function personal() {
            $("#main").load("${hkxyPath}/user/personal", null, null);
            history.pushState(null, null, "${hkxyPath}/user/personal")
        }
        function droptog() {

        }
    </script>
    <c:set var="power" value="${sessionScope.admin.power}"/>
  </head>
  <body class="cbp-spmenu-push myscrollbar" id="body">
  <div class="main-content ">
    <!--left-fixed -navigation-->
    <div class=" sidebar" role="navigation">
      <div class="navbar-collapse">
        <nav class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left myscrollbar" id="cbp-spmenu-s1">

          <ul class="nav" id="side-menu">
            <li>
              <a href="Javascript: void(0)" id="index" onclick="personal()"><i class="fa fa-home nav_icon"></i>个人中心</a>
            </li>
            <c:if test="${power.contains('all')}">
            <li>
              <a href="Javascript: void(0)" id="adminManage"><i class="fa fa-cogs nav_icon"></i>用户管理</a>
            </li>
            </c:if>
            <c:if test="${power.contains('all')}">
            <li>
              <a href="Javascript: void(0)" id="featureManage" onclick="onlyManage('feature')"><i class="fa fa-book nav_icon"></i>学院特色</a>
            </li>
            </c:if>

            <c:if test="${power.contains('all')}">
              <li>
                <a href="Javascript: void(0)" class="chart-nav"><i class="fa fa-bar-chart nav_icon"></i>资源下载 <span class="fa arrow"></span></a>
                <ul class="nav nav-second-level collapse">
                  <li>
                    <a href="Javascript: void(0)" onclick="onlyManage('downloads')">院内资源</a>
                  </li>
                  <li>
                    <a href="Javascript: void(0)" id="ftpManage">FTP</a>
                  </li>
                </ul>
              </li>
            </c:if>

            <c:if test="${power.contains('1')}">
            <li>
              <a href="Javascript: void(0)"><i class="fa fa-th-large nav_icon"></i>新闻动态 <span class="fa arrow"></span></a>
              <ul class="nav nav-second-level collapse">
                <li>
                  <a href="Javascript: void(0)" id="newsPublish" onclick="articlePublish('news')">发布新闻</a>
                </li>
                <li>
                  <a href="Javascript: void(0)" id="newsManage" onclick="articleManage('news')">新闻管理</a>
                </li>
              </ul>
            </li>
            </c:if>

            <c:if test="${power.contains('2')}">
            <li>
              <a href="Javascript: void(0)"><i class="fa fa-th-large nav_icon"></i>通知公告<span class="fa arrow"/></a>
              <ul class="nav nav-second-level collapse">
                <li>
                  <a href="Javascript: void(0)" id="noticePublish" onclick="articlePublish('notice')">发布公告</a>
                </li>
                <li>
                  <a href="Javascript: void(0)" id="noticeManage" onclick="articleManage('notice')">公告管理</a>
                </li>
              </ul>
            </li>
            </c:if>

            <c:if test="${power.contains('3')}">
            <li>
              <a href="Javascript: void(0)"><i class="fa fa-envelope nav_icon"></i>教务信息<span class="fa arrow"></span></a>
              <ul class="nav nav-second-level collapse">
                <li>
                  <a href="Javascript: void(0)" onclick="articlePublish('eduinfo')">发布教务信息</a>
                </li>
                <li>
                  <a href="Javascript: void(0)" onclick="articleManage('eduinfo')">管理教务信息</a>
                </li>
              </ul>
            </li>
            </c:if>

            <c:if test="${power.contains('4')}">
            <li>
              <a href="Javascript: void(0)"><i class="fa fa-table nav_icon"></i>学生工作<span class="fa arrow"></span></a>
              <ul class="nav nav-second-level collapse">
                <li>
                  <a href="Javascript: void(0)" onclick="articlePublish('stuinfo')">发布信息</a>
                </li>
                <li>
                  <a href="Javascript: void(0)" onclick="articleManage('stuinfo')">管理信息</a>
                </li>
              </ul>
            </li>
            </c:if>

            <c:if test="${power.contains('5')}">
            <li>
              <a href="Javascript: void(0)"><i class="fa fa-check-square-o nav_icon"></i>招生信息 <span class="fa arrow"></span></a>
              <ul class="nav nav-second-level collapse">
                <li>
                  <a href="Javascript: void(0)" onclick="articlePublish('admissions')">发布招生信息</a>
                </li>
                <li>
                  <a href="Javascript: void(0)" onclick="articleManage('admissions')">管理招生信息</a>
                </li>
              </ul>
            </li>
            </c:if>

            <c:if test="${power.contains('6')}">
              <li>
                <a href="Javascript: void(0)"><i class="fa fa-check-square-o nav_icon"></i>就业信息 <span class="fa arrow"></span></a>
                <ul class="nav nav-second-level collapse">
                  <li>
                    <a href="Javascript: void(0)" onclick="articlePublish('jobs')">发布就业信息</a>
                  </li>
                  <li>
                    <a href="Javascript: void(0)" onclick="articleManage('jobs')">管理就业信息</a>
                  </li>
                </ul>
              </li>
            </c:if>

            <c:if test="${power.contains('7')}">
            <li>
              <a href="Javascript: void(0)"><i class="fa fa-file-text-o nav_icon"></i>国际交流 <span class="fa arrow"></span></a>
              <ul class="nav nav-second-level collapse">
                <li>
                  <a href="Javascript: void(0)" onclick="articlePublish('communication')">发布信息</a>
                </li>
                <li>
                  <a href="Javascript: void(0)" onclick="articleManage('communication')">管理信息</a>
                </li>
              </ul>
            </li>
            </c:if>

            <c:if test="${power.contains('8')}">
            <li>
              <a href="Javascript: void(0)" class="chart-nav"><i class="fa fa-bar-chart nav_icon"></i>科研工作<span class="fa arrow"></span></a>
              <ul class="nav nav-second-level collapse">
                <li>
                  <a href="Javascript: void(0)" onclick="articlePublish('science')">发布信息</a>
                </li>
                <li>
                  <a href="Javascript: void(0)" onclick="articleManage('science')">管理信息</a>
                </li>
              </ul>
            </li>
            </c:if>

            <c:if test="${power.contains('9')}">
            <li>
              <a href="Javascript: void(0)" class="chart-nav"><i class="fa fa-bar-chart nav_icon"></i>党群工作 <span class="fa arrow"></span></a>
              <ul class="nav nav-second-level collapse">
                <li>
                  <a href="Javascript: void(0)" onclick="articlePublish('cpc')">发布信息</a>
                </li>
                <li>
                  <a href="Javascript: void(0)" onclick="articleManage('cpc')">管理信息</a>
                </li>
              </ul>
            </li>
            </c:if>

            <li>
              <p>.</p>
            </li>
            <li>
              <p>.</p>
            </li>
          </ul>
          <!-- //sidebar-collapse -->
        </nav>
      </div>
    </div>
    <!--left-fixed -navigation-->

    <!-- header-starts -->
    <div class="sticky-header header-section ">
      <div class="header-left">
        <!--toggle button start-->
        <button id="showLeftPush"><i class="fa fa-bars"></i></button>
        <!--toggle button end-->
        <!--logo -->
        <div class="logo">
          <a href="${hkxyPath}/index">
            <h1>中原彼得堡航空学院</h1>
            <span>后台办公管理系统</span>
          </a>
        </div>
        <!--//logo-->

        <div class="clearfix"> </div>
      </div>
      <div class="header-right">

        <div class="profile_details">
          <ul>
            <li class="dropdown profile_details_drop">
              <a href="Javascript: void(0)" onclick="droptog()" id="droptog" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                <div class="profile_img">
                  <span class="prfil-img"><img src="" alt=""> </span>
                  <div class="user-name">
                    <p>${sessionScope.admin.username}</p>
                    <span>${sessionScope.admin.realname}</span>
                  </div>
                  <i class="fa fa-angle-down lnr"></i>
                  <i class="fa fa-angle-up lnr"></i>
                  <div class="clearfix"></div>
                </div>
              </a>
              <ul class="dropdown-menu drp-mnu">
                <li> <a href="Javascript: void(0)" onclick="personal()"><i class="fa fa-user"></i> 个人中心</a> </li>
                <li> <a href="${hkxyPath}/doLogout"><i class="fa fa-sign-out"></i> 注销</a> </li>
              </ul>
            </li>
          </ul>
        </div>
        <div class="clearfix"> </div>
      </div>
      <div class="clearfix"> </div>
    </div>
    <!-- //header-ends -->


    <!-- 右侧内容展示-->
    <div id="page-wrapper">
      <div class="main-page" id="main">
        <h2 class="header-bottom-my1">
          整体文章数量
        </h2>
        <!-- 饼状图 -->
        <div id="pie" style="width: 600px;height:300px;margin:auto"></div>
        <!-- 柱状图： -->
        <div id="bar" style="width:100%;height:300px;margin: auto"></div>
        <script type="text/javascript">
            // 基于准备好的dom，初始化echarts实例
            var pieChart = echarts.init(document.getElementById('pie'));
            pieChart.setOption({
                tooltip: {},
                itemStyle: {
                    // 阴影的大小
                    shadowBlur: 100,
                    // 阴影水平方向上的偏移
                    shadowOffsetX: 0,
                    // 阴影垂直方向上的偏移
                    shadowOffsetY: 0,
                    // 阴影颜色
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                },
                series: [{
                    //统计图类型：pie饼状图
                    type: 'pie',
                    //半径
                    radius:'60%',
                    data:[]
                }]
            });
            var barChart = echarts.init(document.getElementById('bar'));
            // 指定图表的配置项和数据
            barChart.setOption({
                tooltip: {},
                xAxis: {
                    data: ["新闻动态","通知公告","教务信息","学生工作","招生信息","就业信息","国际交流","科研工作","党群工作"]
                },
                yAxis: {},
                series: [{
                    name: '文章数量',
                    type: 'bar',
                    data: []
                }]
            });

            // 异步加载数据
            $.get('${hkxyPath}/article-count-json').done(function (result) {
                console.log(result);
                var data=result.data;
                pieChart.setOption({
                    series: [{
                        data: [
                            {name:"新闻动态",value:data.news},
                            {name:"通知公告",value:data.notice},
                            {name:"教务信息",value:data.eduinfo},
                            {name:"学生工作",value:data.stuinfo},
                            {name:"招生信息",value:data.admissions},
                            {name:"就业信息",value:data.jobs},
                            {name:"国际交流",value:data.communication},
                            {name:"科研工作",value:data.science},
                            {name:"党群工作",value:data.cpc}
                        ]
                    }]
                });
                barChart.setOption({
                    series: [{
                        data: [data.news,data.notice,data.eduinfo,data.stuinfo,data.admissions,data.jobs,data.communication,data.science,data.cpc]
                    }]
                });
            });

        </script>

      </div>
    </div>
    <!-- //右侧内容展示结束-->


    <!--页脚-->
    <div class="footer">
      <p>copyright@2018 Zhongyuan-Petersburg Aviation College.All Rights Reserved</p>
      <p>中原彼得堡航空学院 版权所有 豫ICP16018499</p>
    </div>
    <!--//页脚结束-->


  </div>
  <!-- Classie -->
  <script src="${hkxyPath}/resources/js/classie.js"></script>
  <script>
      var menuLeft = document.getElementById( 'cbp-spmenu-s1' ),
          showLeftPush = document.getElementById( 'showLeftPush' ),
          body = document.body;

      showLeftPush.onclick = function() {
          classie.toggle( this, 'active' );
          classie.toggle( body, 'cbp-spmenu-push-toright' );
          classie.toggle( menuLeft, 'cbp-spmenu-open' );
          disableOther( 'showLeftPush' );
      };


      function disableOther( button ) {
          if( button !== 'showLeftPush' ) {
              classie.toggle( showLeftPush, 'disabled' );
          }
      }
  </script>
  </body>
</html>